package com.wsestadio.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.wsestadio.dao.EstadioDAO;
import com.wsestadio.dao.base.EstadioDAOBase;
import com.wsestadio.dominio.Estadio;
import com.wsestadio.util.DAO;


@SuppressWarnings("unchecked")
@Repository("EstadioDAO")
public class EstadioDAOImpl extends DAO<Estadio> implements EstadioDAO {

	@SuppressWarnings("unused")
	private EstadioDAOBase estadioDAOBase;	

	@Override
	public void setBasicGenericService() {
		estadioDAOBase = new EstadioDAOBase(em);		
	}
	
	@Override
	public List<Estadio> getListaEstadiosActivos() throws Exception {
		sqlQuery = "select p from Estadio p " + 
					" where p.activo = true   ";
		q = em.createQuery(sqlQuery);
		List<Estadio> p = q.getResultList();
		if(p!=null){
			return p;
		}else{
			throw new Exception("No hay regsitros.");
		}
	}

	@Override
	public EstadioDAOBase getBasicService() {
		return estadioDAOBase;
	}




	
}
